home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
cpptut22
/
scopeop.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1992-01-19
|
622b
|
30 lines
// Chapter 1 - Program 2
#include <iostream.h>
int index = 13;
main()
{
float index = 3.1415;
cout << "The local index value is " << index << "\n";
cout << "The global index value is " << ::index << "\n";
::index = index + 7; // 3 + 7 should result in 10
cout << "The local index value is " << index << "\n";
cout << "The global index value is " << ::index << "\n";
}
// Result of execution
//
// The local index value is 3.1415
// The global index value is 13
// The local index value is 3.1415
// The global index value is 10